/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewFeaturesPanel.java
 *
 * Created on Oct 12, 2010, 11:48:26 AM
 */

package vizzy.comp;

import java.awt.Cursor;
import vizzy.listeners.INewFeaturesListener;

/**
 *
 * @author sergei
 */
public class NewFeaturesPanel extends javax.swing.JPanel {
    private INewFeaturesListener listener;

    /** Creates new form NewFeaturesPanel */
    public NewFeaturesPanel(String label, INewFeaturesListener listener) {
        this.listener = listener;
        initComponents();
        jLabel.setText(label);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel = new javax.swing.JLabel();
        jXLabel = new javax.swing.JLabel();

        setBackground(new java.awt.Color(255, 255, 102));
        setMaximumSize(new java.awt.Dimension(32767, 40));
        setPreferredSize(new java.awt.Dimension(425, 40));
        setLayout(new javax.swing.BoxLayout(this, javax.swing.BoxLayout.LINE_AXIS));

        jLabel.setText("<html>Did you know that:<br>New features</html>");
        jLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
        jLabel.setVerticalTextPosition(javax.swing.SwingConstants.TOP);
        jLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jLabelMouseEntered(evt);
            }
        });
        add(jLabel);

        jXLabel.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jXLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jXLabel.setText("X");
        jXLabel.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
        jXLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jXLabelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jXLabelMouseEntered(evt);
            }
        });
        add(jXLabel);
    }// </editor-fold>//GEN-END:initComponents

    private void jXLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jXLabelMouseClicked
        listener.close();
    }//GEN-LAST:event_jXLabelMouseClicked

    private void jLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelMouseClicked
        listener.click();
    }//GEN-LAST:event_jLabelMouseClicked

    private void jXLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jXLabelMouseEntered
        evt.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_jXLabelMouseEntered

    private void jLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelMouseEntered
        evt.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_jLabelMouseEntered


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel;
    private javax.swing.JLabel jXLabel;
    // End of variables declaration//GEN-END:variables

    public void dispose() {
        listener = null;
    }

}
